package com.vcixp;

import org.nutz.mvc.View;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.ioc.provider.ComboIocProvider;
import org.nutz.mvc.view.JspView;
import org.nutz.mvc.view.ViewWrapper;

import com.vcixp.common.filter.Filter;
import com.vcixp.common.util.PropertyUtils;

@IocBy(type = ComboIocProvider.class, args = { "*org.nutz.ioc.loader.json.JsonLoader", "ioc/",
		"*org.nutz.ioc.loader.annotation.AnnotationIocLoader", "com.vcixp" })
@Modules(scanPackage = true)
@Filters({ @By(type = Filter.class) })
public class MainModule {

	@At("/")
	public View index() {
		if (!SystemConstants.INSTALL.equals(PropertyUtils.getProperty(SystemConstants.INSTALL))) {
			return new ViewWrapper(new JspView("install"), null);
		}
		return new ViewWrapper(new JspView("index"), null);
	}
}
